package Demo1;

import java.util.Scanner;

public class demo7 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long[] array = new long[n+1];
        for(int i = 1;i<=n;i++){
            array[i] = in.nextLong();
        }

        long[] sumNum = new long[n+1];
        for(int i = 1;i<=n;i++){
            sumNum[i] = sumNum[i-1]+array[i];
        }

        long ret = 0;
        for(int i = 1;i<n;i++){
            ret+=array[i]*(sumNum[n]-sumNum[i]);
        }

        System.out.println(ret);
    }
}
